<div id="basicListing">
<h1>Events by Trace / Date: <%= @dateFrom.strftime("%A (%m/%d/%Y)") %> to <%= @dateTo.strftime("%A (%m/%d/%Y)") %></h1>
<span id="printThis">
<% form_tag(:controller => "reports", :action => "byeventdays", :id => @user) do %>
<%= select_date(@dateFrom, :prefix => 'dateFrom') %> to <%= select_date(@dateTo, :prefix => 'dateTo') %>
<%= submit_tag 'Update Range' %>
<% end %>
<%= link_to_function(image_tag("print.png",:border => 0), "javascript:print()") %></span>
<br>
<% @traces_by_event.each do |event,traces| %>
  <% @grouped_by_day = traces.group_by {|t| t.created_at.beginning_of_day} %>

  <table border=0>
  <tr><th colspan=3 align="left"><%= Event.find(event).title %> (<%= Event.find(event).ticketNumber %>)</th></tr>
    <% @grouped_by_day.each do |day, traces| %>
      <% @minThisDay = traces.sum(&:minSpent) %>
      <tr>
      <td width="30%"><%= day.strftime("%A (%m/%d/%Y)") %></td>
      <td width="20%"><%= "%02d:%02d" % [(@minThisDay / 60),(@minThisDay % 60)] %></td>
      <td width="50%" align="left"><%= (@minThisDay.to_f/60).round(2) %></td>
      </tr>
    <% end %>
  </table>
  <br>
  
<% end %>

</div>